//
//  SinaTabBarController.m
//  SinaNews
//
//  Created by qianfeng on 15-6-14.
//  Copyright (c) 2015年 耿宁. All rights reserved.
//

#import "SinaTabBarController.h"
#import "AppListViewController.h"
#import "ContainerViewController.h"
#import "BaseViewController.h"
#import "SettingViewController.h"
#import "VideoViewController.h"
@interface SinaTabBarController ()

@end

@implementation SinaTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self creatTopBar];
}

-(void)creatTopBar {
    NSMutableArray *arr=[[NSMutableArray alloc]init];
    
    NSMutableArray *VCArr1=[[NSMutableArray alloc]init];
    
    NSArray *topBarTitles1=@[@"头条",@"体育"];
    NSArray *classNames1=@[@"ToutiaoViewController",@"SportsViewController"];
    NSArray *urlArr1=@[kNewsUrl,kSportUrl];
    for (NSInteger i=0; i<topBarTitles1.count; i++) {
        Class vcClass=NSClassFromString(classNames1[i]);
         AppListViewController *vc1=[[vcClass alloc]init];
        vc1.title=topBarTitles1[i];
        vc1.Url=urlArr1[i];
        [VCArr1 addObject: vc1];
    }
    ContainerViewController *conVC1=[[ContainerViewController alloc]init];
    conVC1.viewControllers=VCArr1;
    conVC1.title=@"新闻";
    conVC1.tabBarItem.image=[UIImage imageNamed:@"tabbar_news"];
    conVC1.tabBarItem.selectedImage=[[UIImage imageNamed:@"tabbar_news_hl"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [arr addObject :conVC1];
    
    NSMutableArray *VCArr2=[[NSMutableArray alloc]init];
    
    NSArray *topBarTitles2=@[@"图片",@"趣图"];
    NSArray *classNames2=@[@"PicViewController",@"FunnyViewController"];
    NSArray *urlArr2=@[kPictureUrl,kFunPicUrl];
    for (NSInteger i=0; i<topBarTitles2.count; i++) {
        Class vcClass=NSClassFromString(classNames2[i]);
        AppListViewController *vc2=[[vcClass alloc]init];
        vc2.title=topBarTitles2[i];
        vc2.Url=urlArr2[i];
        [VCArr2 addObject: vc2];
    }
    ContainerViewController *conVC2=[[ContainerViewController alloc]init];
    conVC2.viewControllers=VCArr2;
    conVC2.title=@"图片";
    conVC2.tabBarItem.image=[UIImage imageNamed:@"tabbar_picture"];
    conVC2.tabBarItem.selectedImage=[[UIImage imageNamed:@"tabbar_picture_hl"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [arr addObject :conVC2];

    NSMutableArray *VCArr3=[[NSMutableArray alloc]init];
   AppListViewController *vc3=[[VideoViewController alloc]init];
    
    vc3.title=@"视频";
    vc3.Url=kVideoUrl;
    [VCArr3 addObject:vc3];
    ContainerViewController *conVC3=[[ContainerViewController alloc]init];
    conVC3.viewControllers=VCArr3;
    conVC3.title=@"视频";
    conVC3.tabBarItem.image=[UIImage imageNamed:@"tabbar_video"];
    conVC3.tabBarItem.selectedImage=[[UIImage imageNamed:@"tabbar_video_hl"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [arr addObject :conVC3];

     NSMutableArray *VCArr4=[[NSMutableArray alloc]init];
     SettingViewController *vc4=[[SettingViewController alloc]init];
    [VCArr4 addObject:vc4];
    ContainerViewController *conVC4=[[ContainerViewController alloc]init];
    conVC4.title=@"我的";
    conVC4.viewControllers=VCArr4;
    conVC4.tabBarItem.image=[UIImage imageNamed:@"tabbar_setting"];
    conVC4.tabBarItem.selectedImage=[[UIImage imageNamed:@"tabbar_setting_hl"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [arr addObject :conVC4];
    
    self.viewControllers=arr;
}















- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
